-- Function: insertaproyectos(integer, character, character, character, date, date, character, character, character, character, character, character, integer)

-- DROP FUNCTION insertaproyectos(integer, character, character, character, date, date, character, character, character, character, character, character, integer);

CREATE OR REPLACE FUNCTION insertaproyectos(integer, character, character, character, date, date, character, character, character, character, character, character, integer)
  RETURNS integer AS
$BODY$
DECLARE 
	iClave 		ALIAS FOR $1;
	cTipo		ALIAS FOR $2;
	cTitulo 	ALIAS FOR $3;
	cEntidad	ALIAS FOR $4;
	dFechai		ALIAS FOR $5;
	dFechaf		ALIAS FOR $6;
	cArea		ALIAS FOR $7;
	cDiciplina	ALIAS FOR $8;
	cSubdiciplina	ALIAS FOR $9;
	cSector		ALIAS FOR $10;
	cRama		ALIAS FOR $11;
	cClase		ALIAS FOR $12;
	iMaestro	ALIAS FOR $13;
	Variable 	integer;
BEGIN
		insert into proyectos values (iClave,cTipo,cTitulo,cEntidad,dFechai,dFechaf,current_date,cArea,cDiciplina,cSubdiciplina,cSector,cRama,cClase,iMaestro);
RETURN Variable;
end;
$BODY$
  LANGUAGE plpgsql VOLATILE
  COST 100;
ALTER FUNCTION insertaproyectos(integer, character, character, character, date, date, character, character, character, character, character, character, integer) OWNER TO postgres;
